
<%if(!(locals.token && token != '')){%>
<link href="<%=resUrl%>/css/template/topReturn.css" rel="stylesheet" type="text/css" />
<div class="<%= topReturnType ?'topReturn2':'topReturn' %>">
    <svg onclick="javascript:goPreUrl()" t="1547129300682" style="margin:0;" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3118" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path fill="#FFFFFF" d="M724.231168 170.105856L380.529664 510.181376l341.477376 345.111552c15.1552 15.154176 15.100928 39.7824-0.116736 55.000064-15.220736 15.220736-39.844864 15.271936-54.99392-3.771392L302.629888 542.255104c-4.916224-5.499904-10.561536-11.995136-11.497472-15.504384-5.75488-14.301184-2.874368-31.873024 8.63744-46.317568l369.355776-369.3568c15.284224-11.387904 40.022016-11.447296 55.243776 3.776512 15.217664 15.220736 15.158272 39.958528-0.13312 55.251968l-0.00512 0.001024z" p-id="3119"></path></svg>
    <%=topTitle || '' %>
    <%if(typeof(userId) != 'undefined' && userId && userId != ''){%>
        <div class="join_blacklist" userId="<%=userId%>"></div>
    <%}%>
</div>
<script>
    function goPreUrl(){
        var url = getLastUrl();
        popLastUrl();
        if(!url){
            <%if(typeof(returnUrl) != 'undefined' && returnUrl && returnUrl != ''){%>
                visitUrl('<%=returnUrl%>');
            <%}else{%>
                visitUrl('/');
            <%}%>
        }
        else 
            visitUrl(url);
    }

    function goCustomUrl(url){
        visitUrl(url);
    }

    var setBlacking = false;
    $('.join_blacklist').click(function(){
        var _this = this;
        var userId = $(_this).attr('userId');
        $.post('/antique/api/userBlacklist/check_blacklist_set',{
            token:getCookie('token'),
            blackUserId:userId
        },function(result){
            if(result.data.black){
                //已经加入黑名单就设置取消黑名单
                $.confirm("您确定将要把该用户取消加入黑名单吗?", "确认取消加入黑名单?", function() {
                    if(setBlacking) return false;
                    setBlacking = true;
                    $.post('/antique/api/userBlacklist/delete_blacklist',{
                        token:getCookie('token'),
                        blackUserId:userId
                    },function(result){
                        setBlacking = false;
                        if (result.code == 0) {
                            $.toast('取消加入黑名单成功!');
                        } else {
                            $.toast(result.message, "cancel");
                        }
                    });
                }, function() {
                    //取消操作

                });
            } else {
                $.confirm("您确定要将该用户加入到黑名单吗?", "确认加入黑名单?", function() {
                    if(setBlacking) return false;
                    setBlacking = true;
                    $.post('/antique/api/userBlacklist/add_blacklist',{
                        token:getCookie('token'),
                        blackUserId:userId
                    },function(result){
                        setBlacking = false;
                        if (result.code == 0) {
                            $.toast('加入黑名单成功!');
                        } else {
                            $.toast(result.message, "cancel");
                        }
                    });
                }, function() {
                    //取消操作

                });
            }
        });
    });
</script>
<%}%>